"use strict";
cc._RF.push(module, 'e8542K67iZKXolziLEaP35X', 'CarUnlock');
// scripts/CarUnlock.js

"use strict";

var t = require;
var e = module;
var o = exports;

var _i,
    n = void 0 && (void 0).__extends || (_i = function i(t, e) {
  return (_i = Object.setPrototypeOf || {
    __proto__: []
  } instanceof Array && function (t, e) {
    t.__proto__ = e;
  } || function (t, e) {
    for (var o in e) {
      Object.prototype.hasOwnProperty.call(e, o) && (t[o] = e[o]);
    }
  })(t, e);
}, function (t, e) {
  function o() {
    this.constructor = t;
  }

  _i(t, e), t.prototype = null === e ? Object.create(e) : (o.prototype = e.prototype, new o());
}),
    a = void 0 && (void 0).__decorate || function (t, e, o, i) {
  var n,
      a = arguments.length,
      r = a < 3 ? e : null === i ? i = Object.getOwnPropertyDescriptor(e, o) : i;
  if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(t, e, o, i);else for (var s = t.length - 1; s >= 0; s--) {
    (n = t[s]) && (r = (a < 3 ? n(r) : a > 3 ? n(e, o, r) : n(e, o)) || r);
  }
  return a > 3 && r && Object.defineProperty(e, o, r), r;
};

Object.defineProperty(o, "__esModule", {
  value: !0
});

var r = t("GlobalUserData"),
    s = t("HallConstant"),
    l = t("Util"),
    c = cc._decorator,
    d = c.ccclass,
    h = c.property,
    p = function (t) {
  function e() {
    var e = null !== t && t.apply(this, arguments) || this;
    return e.spr_tip = null, e.frame_c1 = null, e.frame_c2 = null, e.spr_btn = null, e.frame_btnTxt = null, e.node_Damd = null, e.node_Trophy = null, e.color_red = null, e.color_green = null, e.node_videoIcon = null, e.label_value = null, e._hallControl = null, e;
  }

  return n(e, t), e.prototype.init = function (t, e, o) {
    this._cb = t, this._curIndex = o, this._hallControl = e, this.node_Damd.active = !1, this.node_Trophy.active = !1, this.node_videoIcon.active = !1, this.showContent();
  }, e.prototype.onEnable = function () {
    l.Util.hideSingleCustomAd(), l.Util.showBanner(), l.Util.show_VerticalCustomAd(!1), l.Util.show_VerticalCustomAd(!0);
  }, e.prototype.onDisable = function () {
    l.Util.showSingleCustomAd(), l.Util.showInterstitialAd(), l.Util.hideBanner(), l.Util.hide_VerticalCustomAd(!1), l.Util.hide_VerticalCustomAd(!0);
  }, e.prototype.showContent = function () {
    switch (this._curIndex) {
      case 1:
        this.spr_tip.spriteFrame = this.frame_c1, this.node_Damd.active = !0, this.label_value = this.node_Damd.getChildByName("dvalue").getComponent(cc.Label), this.label_value.string = r["default"].nDiamond.toString(), this._isMeet = r["default"].nDiamond >= 50;
        break;

      case 2:
        this.label_value = this.node_Trophy.getChildByName("dvalue").getComponent(cc.Label), this.label_value.string = r["default"].nTrophy.toString(), this._isMeet = !0, this.node_videoIcon.active = !0, r["default"].videoTab = 27, l.Util.videoExposure(r["default"].videoTab);
    }

    this._isMeet ? this.label_value.node.color = this.color_green : (this.spr_btn.spriteFrame = this.frame_btnTxt, this.label_value.node.color = this.color_red);
  }, e.prototype.onBtnUnlock = function () {
    if (this._isMeet) switch (this._curIndex) {
      case 1:
        r["default"].saveDiamondData(!1, 50), this._hallControl.onSetOwnDiamond(), this._cb(), r["default"].nGuideStep == s.Guide_Step.UnlockCar_2 && (r["default"].saveGuideStepData(s.Guide_Step.Assembly_In_2), this._hallControl.onGuideAction()), this.onBtnClose();
        break;

      case 2:
        l.Util.showRewardVideo(this.videoUnlock.bind(this));
    } else switch (this._curIndex) {
      case 1:
        this._hallControl.onBtnAddDiamond(), this.onBtnClose();
        break;

      case 2:
        this.onBtnClose();
    }
  }, e.prototype.videoUnlock = function () {
    this._cb(), this.onBtnClose();
  }, e.prototype.onBtnClose = function () {
    this.node.destroy();
  }, a([h(cc.Sprite)], e.prototype, "spr_tip", void 0), a([h(cc.SpriteFrame)], e.prototype, "frame_c1", void 0), a([h(cc.SpriteFrame)], e.prototype, "frame_c2", void 0), a([h(cc.Sprite)], e.prototype, "spr_btn", void 0), a([h(cc.SpriteFrame)], e.prototype, "frame_btnTxt", void 0), a([h(cc.Node)], e.prototype, "node_Damd", void 0), a([h(cc.Node)], e.prototype, "node_Trophy", void 0), a([h(cc.Color)], e.prototype, "color_red", void 0), a([h(cc.Color)], e.prototype, "color_green", void 0), a([h(cc.Node)], e.prototype, "node_videoIcon", void 0), a([d], e);
}(cc.Component);

o["default"] = p;

cc._RF.pop();